package com.wing.purchase.model.entity;

import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 询价单
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("pur_purchase_enquiry")
public class PurchaseEnquiry extends BaseEntity<PurchaseEnquiry> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum Status implements IEnum<Integer> {

        /**
        * 待报价
        */
        stayOffer(0,"待报价"),
        /**
        * 确认中
        */
        confirm(1,"确认中"),
        /**
        * 已确认
        */
        finish(2,"已确认"),
        /**
        * 确认驳回
        */
        reject(3,"确认驳回");

        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum EnquiryStatus implements IEnum<Integer> {

        /**
        * 询价中
        */
        inquiry(0,"询价中"),
        /**
        * 询价结束
        */
        finish(1,"询价结束");

        private int code;
        private String desc;

        EnquiryStatus(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 询价单号
     */
    private String inquiryNo;

    /**
     * 请购单id
     */
    private Long purchaseRequisitionsId;

    /**
     * 供应商ids
     */
    private String supplierIds;

    /**
     * 状态
     */
    private Status status;

    /**
    * 状态描述
    */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    /**
     * 询价状态
     */
    private EnquiryStatus enquiryStatus;

    /**
    * 询价状态描述
    */
    @TableField(exist = false)
    private String enquiryStatusDesc;

    public String getEnquiryStatusDesc() {
        return enquiryStatus == null ? null : enquiryStatus.getDesc();
    }

    /**
     * 是否公开
     */
    private Boolean hasPublic;

    /**
    * 询价结束时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime inquiryEndTime;

    /**
    * 交货开始时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime deliveryStartTime;

    /**
    * 交货截止时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime deliveryTime;

    /**
     * 联系人
     */
    private String contactPerson;

    /**
     * 联系人电话
     */
    private String contactNumber;

}
